const meet = require("../../database/meetingRoom");

module.exports = async (req, res, next)=>{
  const {rId, state, size, rName} = req.query;

  const where = {};
  
  if(rId) where.rId = rId;
  if(rName) where.rName = rName;
  if(state) where.state = Boolean(state-0);
  if(size){
    where.number = size==="small" ? {$lte:9, $gte:1} : (size==="middle" ? {$lte:19, $gte:10} : {$gte:20})
  }

  const data = await meet.find(where, {_id:0,__v:0});

  res.send({
    code:1,
    msg:"获取成功",
    data
  })
}
